Repository navigation
Phase 2d: Port project init and sketch detection to Rust - #33
Merged
Merged
Conversation
- Add `crates/fastled-cli/src/project.rs` with `find_sketches`, `is_fastled_repo`, `is_sketch_dir`, `init_example`, and `best_sketch_match` (Jaro-Winkler fuzzy matching via strsim) - Wire `mod project` into `main.rs` - Expose `project_available()` PyO3 stub in `fastled-py` - Add `strsim = "0.11"` to workspace dependencies - Move `tempfile` from dev-dependencies to regular dependencies in fastled-cli (needed by `init_example` at runtime) - 14 new Rust tests covering sketch detection, FastLED repo detection, and fuzzy name matching; all 34 workspace tests pass Closes #21
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
crates/fastled-cli/src/project.rsporting the core logic fromsrc/fastled/project_init.pyandsrc/fastled/sketch.pyto Ruststrsim(Jaro-Winkler distance), replacing the Pythonrapidfuzz-based approach for Rust callersproject_available()PyO3 stub infastled-pyso Python can detect the capability at runtimeNew public API (
project.rs)find_sketches(root: &Path) -> Vec<PathBuf>— finds directories with.ino/.cpp/platformio.ini, recurses intoexamples/up to 3 levels deepis_fastled_repo(path: &Path) -> bool— detects a FastLED repo vialibrary.properties,src/FastLED.h, orlibrary.jsonis_sketch_dir(dir: &Path) -> bool— returns true when a directory contains at least one qualifying fileinit_example(example_name: &str, dest: &Path, branch: Option<&str>) -> Result<PathBuf>— downloads a FastLED example from GitHub and copies it todestbest_sketch_match(query: &str, candidates: &[&str]) -> Vec<String>— substring fast-path then Jaro-Winkler fuzzy fallbackTest plan
./_cargo build --workspace— compiles clean./_cargo test --workspace— 34 Rust tests pass (14 new inproject.rs)./_cargo clippy --workspace --all-targets -- -D warnings— clean./_cargo fmt --all --check— cleanbash lint— passesbash test— 121 Python tests passCloses #21